#include "nano_message.h"
#include <godot_cpp/core/class_db.hpp>
using namespace godot;


void NanoMessage::_bind_methods() {
	// Add method bindings here.
	BIND_ENUM_CONSTANT(TYPE_REQUEST);
	BIND_ENUM_CONSTANT(TYPE_NOTIFY);
	BIND_ENUM_CONSTANT(TYPE_RESPONSE);
	BIND_ENUM_CONSTANT(TYPE_PUSH);

	ClassDB::bind_method(D_METHOD("set_type", "type"), &NanoMessage::set_type);
	ClassDB::bind_method(D_METHOD("get_type"), &NanoMessage::get_type);
	ClassDB::bind_method(D_METHOD("set_id", "id"), &NanoMessage::set_id);
	ClassDB::bind_method(D_METHOD("get_id"), &NanoMessage::get_id);
	ClassDB::bind_method(D_METHOD("set_compress_route", "compress_route"), &NanoMessage::set_compress_route);
	ClassDB::bind_method(D_METHOD("get_compress_route"), &NanoMessage::get_compress_route);
	ClassDB::bind_method(D_METHOD("set_route", "route"), &NanoMessage::set_route);
	ClassDB::bind_method(D_METHOD("get_route"), &NanoMessage::get_route);
	ClassDB::bind_method(D_METHOD("set_body", "body"), &NanoMessage::set_body);
	ClassDB::bind_method(D_METHOD("get_body"), &NanoMessage::get_body);
	ClassDB::bind_method(D_METHOD("is_valid"), &NanoMessage::is_valid);

	ADD_PROPERTY(PropertyInfo(Variant::INT, "type", PROPERTY_HINT_ENUM, "TYPE_REQUEST,TYPE_NOTIFY,TYPE_RESPONSE,TYPE_PUSH"), "set_type", "get_type");
	ADD_PROPERTY(PropertyInfo(Variant::INT, "id"), "set_id", "get_id");
	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "compress_route"), "set_compress_route", "get_compress_route");
	ADD_PROPERTY(PropertyInfo(Variant::STRING, "route"), "set_route", "get_route");
	ADD_PROPERTY(PropertyInfo(Variant::PACKED_BYTE_ARRAY, "body"), "set_body", "get_body");
}

